package com.pjl.restartlife.homepage.controller;

import com.pjl.restartlife.homepage.service.WeatherService;
import com.pjl.restartlife.homepage.vo.WeatherVo;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author pjl
 * @create 2024/04/2024/4/26
 * @description
 */
@RestController
public class WeatherController {
   @Autowired
   private WeatherService weatherService;
   @GetMapping("/weather")
   public WeatherVo getWeather(HttpServletRequest request, @RequestBody HashMap<String,String> Map) {
      WeatherVo weatherVo = new WeatherVo();
      weatherVo = weatherService.getWeather(Map.get("city"));
      return weatherVo;
   }
}
